﻿<UserControl x:Class="ScrumFactory.Login.Login"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:props="clr-namespace:ScrumFactory.Login.Properties"        
             xmlns:SF_Helpers="clr-namespace:ScrumFactory.Windows.Helpers;assembly=ScrumFactory.Windows.Helpers"
             
             mc:Ignorable="d" 
             d:DesignHeight="540" d:DesignWidth="936"
             
                          xmlns:SF_Comp="clr-namespace:ScrumFactory.Composition;assembly=ScrumFactory.Composition"                             
        
            x:Name="thisView"

           
            SnapsToDevicePixels="True"
        >
   
    <UserControl.Resources>        
        <DataTemplate x:Key="ProviderTemplate">
            <Button Style="{StaticResource CleanButton}"
                    Width="210" Height="64"
                    Command="{Binding Model.SignInCommand, ElementName=thisView}" CommandParameter="{Binding .}"
                    ToolTip="{Binding ProviderName}"
                    Margin="0,10,10,10">                
                <Border BorderThickness="3" >
                    <Border.Background>
                        <ImageBrush ImageSource="{Binding ProviderImageUrl}" TileMode="None"/>
                    </Border.Background>                    
                    <Border.Style>
                        <Style>
                            <Setter Property="Border.BorderBrush" Value="#DDDDDD"/>
                            <Style.Triggers>
                                <Trigger Property="Border.IsMouseOver" Value="True">
                                    <Setter Property="Border.BorderBrush" Value="{StaticResource LinkBrush}"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </Border.Style>
                </Border>                
            </Button>                
        </DataTemplate>
    </UserControl.Resources>
    
    <SF_Helpers:PanelLayout 
        ShowCurrentProjectName="False"
        Title="{x:Static props:Resources.Sign_in}"  Background="Transparent" BorderBrush="Transparent">

            <SF_Helpers:PanelLayout.Content>

                <Grid>
                    <Image VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="800" Height="742" Source="\Images\logoBig.png" Opacity="0.1" Margin="0,0,-100,-300"/>

                    <StackPanel>
                        
                        <TextBlock Style="{StaticResource TitleTextBlock}" Text="{x:Static props:Resources.Sign_in_using}" Margin="0"/>

                    <StackPanel Margin="0,10,0,0">
                        <TextBlock Text="{Binding ServerUrl, StringFormat={x:Static props:Resources.You_are_connecting_at_a_corporate_server_N}}" Foreground="White" FontWeight="Bold"/>
                        <TextBlock  Margin="0,0,0,10" >
                            <Hyperlink Command="{Binding SetDemoServerCommand}" Style="{StaticResource WhiteHyperlink}" >
                                <Run Text="{x:Static props:Resources.Click_here_to_use_the_demo_server}"/>
                            </Hyperlink>
                        </TextBlock>
                        <StackPanel.Style>
                            <Style TargetType="StackPanel">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsPublicServer}" Value="True">
                                        <Setter Property="Visibility" Value="Collapsed"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </StackPanel.Style>
                    </StackPanel>
                        

                    <ItemsControl
                        Margin="0,10,0,0"
                            HorizontalAlignment="Left" 
                            ItemTemplate="{StaticResource ProviderTemplate}"
                            ItemsSource="{Binding AllProviders}">
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <WrapPanel  HorizontalAlignment="Left" />
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                        </ItemsControl>

                    <Border CornerRadius="5" Background="{StaticResource CoverAreaBrush}" HorizontalAlignment="Left" Padding="10" Margin="0,20,0,0">
                        <StackPanel>
                            <TextBlock >
                                <Image Source="/Images/information.png" Width="16" Height="16" VerticalAlignment="Center" />
                                <Hyperlink Command="{Binding SetServerUrlVisibleCommand}" Style="{StaticResource WhiteHyperlink}" BaselineAlignment="Top" >
                                    <Run Text="{x:Static props:Resources.Click_here_to_use_a_corporate_server}"/>                            
                                </Hyperlink>
                            </TextBlock>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Style="{StaticResource LabelTextBlock}" Text="{x:Static props:Resources.server_address}"/>
                                <TextBox        
                                    BorderBrush="{StaticResource TextBoxBackgroundBrush}" Text="{Binding ServerUrl}" Width="600" />
                                <StackPanel.Style>
                                    <Style TargetType="StackPanel">
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding IsServerUrlVisible}" Value="False">
                                                <Setter Property="Visibility" Value="Collapsed"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </StackPanel.Style>
                            </StackPanel>
                            
                        </StackPanel>
                        <Border.Style>
                            <Style TargetType="Border">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsPublicServer}" Value="False">
                                        <Setter Property="Visibility" Value="Collapsed"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Border.Style>
                    </Border>
            

                </StackPanel>
                </Grid>

         
            </SF_Helpers:PanelLayout.Content>
        </SF_Helpers:PanelLayout>
            
</UserControl>
